﻿/********************************************************
*	Strategy : 引入策略的接口类                         *
*	张永锋                                              *
*	zhangyf07@gmail.com                                 *
*	2010.8                                              *
*********************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace UI
{
    [StructLayout(LayoutKind.Sequential)]
    public struct Point
    {
        public int x;
        public int y;
        public Point(int x, int y)
        {
            this.x = x;
            this.y = y;
        }
    }

    public class Strategy
    {
        //注意：这个地方应当考虑文件不存在的情况
        [DllImport("./StrategyFile/StrategyFile.dll")]
        public static extern unsafe Point* getPoint(int M, int N, int* _top, int* _board, int lastX, int lastY, int noX, int noY);
        [DllImport("./StrategyFile/StrategyFile.dll")]
        public static extern unsafe void clearPoint(Point* p);
    }

    public class StrategyA
    {
        [DllImport("./StrategyFile/StrategyFileA.dll")]
        public static extern unsafe Point* getPoint(int M, int N, int* _top, int* _board, int lastX, int lastY, int noX, int noY);
        [DllImport("./StrategyFile/StrategyFileA.dll")]
        public static extern unsafe void clearPoint(Point* p);
    }

    public class StrategyB
    {
        [DllImport("./StrategyFile/StrategyFileB.dll")]
        public static extern unsafe Point* getPoint(int M, int N, int* _top, int* _board, int lastX, int lastY, int noX, int noY);
        [DllImport("./StrategyFile/StrategyFileB.dll")]
        public static extern unsafe void clearPoint(Point* p);
    }
}
